<?php
/**
 * code 4xx
 * @author lgl
 *
 */
import('baseview.class.php');

define('PUSH_S_OK',400);
define('PUSH_F_NEED_LOGIN', 421);
define('PUSH_F_UNKOWN_REASON', 422);
define('PUSH_F_TOO_MUCH',423);// 请求过于频繁
define('PUSH_F_NEED_ASSOC',424);
define('PUSH_F_NEED_CONTENT',425);


class ViewPush extends BaseView{
	
	
	public function getViewByCode($code){
		switch ($code){
			case PUSH_S_OK:
				return parent::getSuccessView(PUSH_S_OK, 'ok');
			case PUSH_F_NEED_ASSOC:
				return parent::getFailedView(PUSH_F_NEED_ASSOC, 'Associate first.');
			case PUSH_F_NEED_LOGIN:
				return parent::getFailedView(PUSH_F_NEED_LOGIN, 'Login first.');
			case PUSH_F_TOO_MUCH:
				return parent::getFailedView(PUSH_F_TOO_MUCH, 'Push msg too much.');
			case PUSH_F_NEED_CONTENT:
				return parent::getFailedView(PUSH_F_NEED_CONTENT, 'Message content is need.');
			case PUSH_F_UNKOWN_REASON:
			default:
				return parent::getFailedView(PUSH_F_UNKOWN_REASON, 'Unkwon reason.');
		}
	}
}